import { defHttp } from '@/utils/http/axios';

enum Api {
  GetIndex = '/agent/newOrderReview/index',
  GetOrder = '/agent/collectionOrderManagement/index',
  GetCollection = '/agent/collectionMessage/index',
  ReviewOrder = '/agent/collectionOrderManagement/ReviewOrder',
  CloseOrder = '/agent/collectionOrderManagement/CancelOrder',
  GetCollectionIndex = '/agent/collection/index',
  GetCollectionOrderInfo = '/agent/collection/OrderSuccess',
  GetCollectionCode = '/agent/collection/code',
  EditCollection = '/agent/collection/editCode',
  DeleteCollection = '/agent/collection/delCode',
  GetCollectionCount = '/agent/orderStatistics/index',
  GetBanks = '/agent/collection/banks',
  AddCollection = '/agent/collection/addCode',
  GetArea = '/agent/collectionMessage/area',
  ConfirmReceipt = '/agent/newOrderReview/confirmReceipt',
  ReviewReceipt = '/agent/newOrderReview/ReviewOrder',
  OrderInfo = '/agent/newOrderReview/orderReviewEdit',
  EditCollectionArray = '/agent/collection/editListStatus',
}

export function EditCollectionArrayApi(params) {
  return defHttp.post<any>({
    url: Api.EditCollectionArray,
    params,
  });
}

export function getIndexApi(params: any) {
  return defHttp.post<any>({
    url: Api.GetIndex + `?page=${params.page}&limit=${params.pageSize}`,
    params,
  });
}

export function getOrderApi(params: any) {
  return defHttp.post<any>({
    url: Api.GetOrder + `?page=${params.page}&limit=${params.pageSize}`,
    params,
  });
}

export function getCollectionApi(params?: any) {
  return defHttp.post<any>({
    url: Api.GetCollection + `?page=${params.page}&limit=${params.pageSize}`,
    params,
  });
}

export function ReviewOrderApi(params: { orderNo: string }) {
  return defHttp.post<any>({
    url: Api.ReviewOrder,
    params,
  });
}

export function CloseOrderApi(params: { orderNo: string }) {
  return defHttp.post<any>({
    url: Api.CloseOrder,
    params,
  });
}

export function getCollectionIndexApi(params: any) {
  return defHttp.post<any>({
    url: Api.GetCollectionIndex + `?page=${params.page}&limit=${params.pageSize}`,
    params,
  });
}

export function GetCollectionOrderInfo(params: { id: string }) {
  return defHttp.post<any>({
    url: Api.GetCollectionOrderInfo,
    params,
  });
}
export function GetCollectionCodeApi(params: any) {
  return defHttp.post<any>({
    url: Api.GetCollectionCode,
    params,
  });
}
export function EditCollectionApi(params: any) {
  return defHttp.post<any>({
    url: Api.EditCollection,
    params,
  });
}

export function DeleteCollectionApi(params: { ids: string[] }) {
  return defHttp.delete<any>({
    url: Api.DeleteCollection,
    params,
  });
}

export function GetCollectionCountApi(params: any) {
  return defHttp.post<any>({
    url: Api.GetCollectionCount + `?page=${params.page}&limit=${params.pageSize}`,
    params,
  });
}

export function GetBanksApi(params: any) {
  return defHttp.post<any>({
    url: Api.GetBanks,
    params,
  });
}

export function AddCollectionApi(params: any) {
  return defHttp.post<any>({
    url: Api.AddCollection,
    params,
  });
}

export function GetAreaApi(params: { id: string }) {
  return defHttp.post<any>({
    url: Api.GetArea,
    params,
  });
}

export function ConfirmReceiptApi(params: { orderNo: string }) {
  return defHttp.post<any>({
    url: Api.ConfirmReceipt,
    params,
  });
}

export function ReviewReceiptApi(params: { orderNo: string }) {
  return defHttp.post<any>({
    url: Api.ReviewReceipt,
    params,
  });
}

export function OrderInfoApi(params: { orderNo: string }) {
  return defHttp.post<any>({
    url: Api.OrderInfo,
    params,
  });
}
